package com.xx.controller;

import com.xx.service.HandSetService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import javax.annotation.Resource;
/**
 * @author 许欣
 * 时间：2022/5/2 19:58
 * 描述：
 */
@Controller
@RequestMapping("/hand")
public class HandSetController {

    @Resource
    private HandSetService handSetService;

    //显示所有信息
    @RequestMapping(value = "/list")
    public String findAll(Model model){
        model.addAttribute("list", handSetService.findAll());
        return "list";
    }
    //根据id查询
    @RequestMapping(value = "/view/{hsId}")
    public String details(@PathVariable Integer hsId, Model model){
        model.addAttribute("lists", handSetService.findById(hsId));
        return "view";
    }

    //删除
    @RequestMapping(value = "/del/{hsId}")
    public String del(@PathVariable Integer hsId, Model model){
        handSetService.del(hsId);
        return "redirect:/hand/list";
    }
}
